package flyweight;

import java.util.concurrent.ConcurrentHashMap;

public class FlyweightFactory {
	private ConcurrentHashMap<String, Flyweight> map=new ConcurrentHashMap<>();
	public Flyweight get(String str){
		Flyweight flyweight = map.get(str);
		if(null==flyweight){
			flyweight=new ConcreteFlyweight(str);
			map.put(str, flyweight);
		}
		return flyweight;
	}
}
